home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
JCSM Shareware Collection 1993 November
/
JCSM Shareware Collection - 1993-11.iso
/
cl720
/
vxbase1j.lzh
/
VXFORM1.FRM
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1993-05-07
|
26KB
|
578 lines
VXFORM1
4vxBase Sample Application: Aircraft Brokerage System
Form1%
Picture1
DDDK0
DKDK0
DKDK0
Label1
vxBase Sample Application
MS SerifgffA1
FileMenu
&File
OpenTypes
&Types
OpenCust
&Customers
OpenAircraft
&Aircraft
BuyBrowse
&Buyers
SepBar
ExitCode
LinkMenu
&Link
LinkBuyToSell
&Buyer to Sellers
LinkSellToBuy
&Seller to Buyers
PicMenu
Show &Pictures
MaintMenu
&Maintenance
PackFiles
&Pack
TestMenu
&Test
TestCreate
&Create
TestCopy
Copy &Structure
TestDataCopy
Copy &Data
FileStruc
&File Structure
RecStruc
&Record Structure
UMenu
&User Browse Menus
TextForm
&Text Formatting
RelStart
&Alias && Relations
PrintItem
&Printer Stuff
ExitCode_Click
VXFORM1
Form_Unload
Cancel
CanClose
Form2Activew
FALSE
Form3Active
Form4Active
Form5Active
Form6Active
Form7ActiveL
AircraftDbfo
vxUseDbf=
Aircraf1Ntx~
vxUseNtx[
Aircraf2Ntx
AirbuyerDbfi
Airbuy1Ntx
Airbuy2Ntx
vxCloseAll
vxCtlGrayReset#
vxDeallocate
OpenTypes_Click
TypesOpenb
BrowseTypes
OpenCust_Click
AircustDbf
Aircust1Ntx
Aircust2Ntx
Aircust3Ntx5
vxTableDeclare
VX_BLUEP
vxTableFieldj
VX_FIELD&
StatesOpen
vxSelectDbfS
vxSelectNtx
BrowseCust
OpenAircraft_Click
AircraftOpenH
BrowseAirx
LinkBuyToSell_Click7
VX_EXPR
vxClose
VX_RED
vxJoinU
OpenCust,
Enabled
LinkBuyToSell
LinkSellToBuy
PackFiles=
vxBrowse
hWndq
BuyerReturn
LinkSellToBuy_Click
AircraftReturnr
TestCreate_Click
TypeFile
FileStruc
NumFieldsF
NewRet
OpenTypes
TestCreate
TestCopy.
TestDataCopy
Fld01}
Fld02
vxCreateDbf)
TypeDbf
TypeNtx
vxCreateNtx
vxAppendFrom
PackFiles_Click
vxAreaDbfa
AirTypesDbf
AirTypesNtx:
vxPack
TestCopy_Click
NtxExpr
vxNtxExprH
vxCopyStrucQ
TestDataCopy_Click
vxCopy^
StartRecL
EndRecQ
vxDeleteRanges
vxUnlock
NtxName
vxNtxName
FileStruc_Click
VXFORM7+
Form_Paint
vxFormFrame7
Form_Click
OpenAircraft
RecStruc_Click
VXFORM8
UMenu_Click
vxMenuDeclare:
vxMenuItem
VX_MENUHEAD
VX_RETURN
VX_SEPBAR
vxBrowsePos
TypeReturn
UMenus
vxCtlGraySet
LinkMenu_Click
TestMenu_Clickc
TextForm_Click
VXFORM9
vxZap
RelStart_Click
VYFORM0
BuyBrowse_Click%
vxTopG
vxSetAlias0
ErrCode
vxSetRelation
VYForm0DisplayR
BuyerRec
CustKey
BROWSE_ERROR
VXFORM3
BROWSE_CLOSED
vxTableReset
vxSeek
CustReturn
BROWSE_EDIT
VXFORM4
vxTabbeField
vxTableFieldExt
vxRecNum
vxRecNo
TrueOrFalseA
vxSetMeters
Form_Resize
PrintItem_ClickU
VYFORM1
PicMenu_Click
VYFORM2
vxEof
vxSkip
BuyBrowse_Click
example of using vxSetRelationt
and vxTableFieldExt to produced
a browse table with fields from
multiple databases included on each row
open child files first-
\vb\vxbtest\aircust.dbf
\vb\vxbtest\aircust1.ntx
put something in record buffer-
\vb\vxbtest\airtypes.dbf
\vb\vxbtest\airtypes.ntx
open parent file (has many records)
\vb\vxbtest\airbuyer.dbf
\vb\vxbtest\airbuy1.ntx
define alias names so we can use field
qualifiers when extracting data
buyer
customer
define relationship to current selection
the 1st param defines the file we setting
up the relationship to (the child file)
and the second param tells vxbase how to
construct a key to be used on the current
index in use on the child filet
b_code
1st relation failed
b_cat
2nd relation failed
now when we issue vxTop(), the two related
file pointers will move to match the values
in the parent file key fields
define the browse table with the extended
vxTableFieldExt functionw
b_code
a_name
b_cat
Description
catname
b_low
b_high
Execute the browse routine
Buyer Records
ExitCode_Click
The master form VXFORM1 is unloaded.-
The Form_Unload procedure does thed
final cleanup.d
FileStruc_Click
disable items that would be affected by
closing of aircust file
Form_Click
test for active forms and set
menu items accordingly. We do this here
as well as when we start up our forms
because some functions allow otherr
functions to be active and when one or
the other is closed and menu items are
re-enabled, then we mess up our menur
disabling for the ones left open.
Form_Paint
Form_Resize
Form_Unload
This routine is activated from either the
Exit menu item on VXFORM1 or by selecting
the Close item from the system menu.c
We MUST test the vxCloseAll result in
case there are any active browse windowsg
that require closure before we cani
terminate the application
If the close operation is successful, any
open databases FOR THIS TASK are closed
(which updates the database header information)
and all attached memory objects (Tables and Joins)-
are released.
if any of our other forms are active, we-
cannot close this form and exit the app
Sub forms must be closed first
redraw top level form
NOTE: we cannot use the FORM.Visible property to-
check if any forms are active because as soon as-
we reference a form, it gets loaded - and our app
will stall with No Database messages because as soon
as the form is loaded, the database attached to that
form is referencedd
test vxcloseall with some files open-
\vb\vxbtest\aircraft.dbf
\vb\vxbtest\aircraf1.ntx
\vb\vxbtest\aircraf2.ntx
\vb\vxbtest\airbuyer.dbf
\vb\vxbtest\airbuy1.ntx
\vb\vxbtest\airbuy2.ntx
redraw top level form
if this is master vxbase task and other
vxbase tasks are active then we can't exite
reset system disabled color
LinkBuyToSell_Click
Demonstration of setting up visual relationships-
with the vxJoin command. What we have is a file of buyers
categorized by type of aircraft they are interested in.
What we are going to do is display a browse table ofi
these buyer records and link any buyer record toe
another browse table of aircraft that match the the
buyer aircraft type field.r
Conversely, the LinkSellToBuy proc does the opposite. It
links the aircraft with all prospective buyers.
open file that will control the join-
\vb\vxbtest\airbuyer.dbf
\vb\vxbtest\airbuy2.ntx
this index is on aircraft type
define table to show data we are interested in-
b_cat
Description
left(b_desc,20)
b_low
b_high
Customer
b_code
now open secondary file and define its table
\vb\vxbtest\aircraft.dbf
Error Opening aircraft.dbf. Aborting.
\vb\vxbtest\aircraf2.ntx
on type
c_cat
c_code
Price
c_price
c_year
c_ttsn
reselect the master file and set up the join
b_cat
Possible Sales
this joins the Aircraft file using the index selected for
it to the buyer file. The "b_cat" param is the field we
will use as a key into the aircraft file and the VX_FIELD
item tells vxBase that it is a field and not an expression.
The last item in the call is a title for the join window.
disable menu items that might affect our display-
now set up and execute the browse. The JOIN menu item is-
automatically enabled.
Buyer Details
when we return from the browse we can ignore anything
vxBase sent back to us in the BuyerReturn param
we could get fancy and get the customer record if the
use hit enter and then display or edit it. Do
whatever you like.t
re-enable menu items-
LinkSellToBuy_Click
Browse the aircraft for sale file and join to
potential buyers. See a more detailed explanantion of
visual relationships in the LinkBuyToSell Proct
open file that will control the join-
\vb\vxbtest\aircraft.dbf
Error Opening aircraft.dbf. Aborting.
\vb\vxbtest\aircraf2.ntx
on type
define table to show data we are interested iny
c_cat
Description
left(c_desc,20)
c_code
Price
c_price
c_year
c_ttsn
now open secondary file and define its table
\vb\vxbtest\airbuyer.dbf
Error Opening airbuyer.dbf. Aborting.
\vb\vxbtest\airbuy2.ntx
b_cat
b_low
b_high
Customer
b_code
reselect the master file and set up the join
c_cat
Possible Buyers
this joins the buyer file using the index selected for
it to the aircraft file. The "c_cat" param is the field we
will use as a key into the buyer file and the VX_FIELDd
item tells vxBase that it is a field and not an expression.
The last item in the call is a title for the join window.
disable menu items-
now set up and execute the browse. The JOIN menu item is-
automatically enabled.
Aircraft Record Display
when we return from the browse we can ignore anything
vxBase sent back to us in the BuyerReturn param
re-enable menu items-
OpenAircraft_Click
both routines in VXBMOD.BAS
OpenCust_Click
open brokerage customers file
\vb\vxbtest\aircust.dbf
Error Opening aircust.dbf. Aborting.
\vb\vxbtest\aircust1.ntx
\vb\vxbtest\aircust2.ntx
\vb\vxbtest\aircust3.ntx
Declare Customer Tablen
a_code
a_name
a_city
State
a_state
Res Phone
a_phoneres
Bus Phone
a_phonebus
open state abbreviations file
in VXBMOD.BAS
start browse tableS
in module VXMOD.BAS
OpenTypes_Click
in VXBMOD.BAS
start browse tableS
in module file VXBMOD.BAS
PackFiles_Click
removes logically deleted records
and reindexes
test pack with bitmaps
j% = vxUseDbf("\vb\vxbtest\airpics.dbf")
j% = vxPack(VXFORM1.hWnd)
j% = vxClose()F
set meter bar off for this file
\vb\vxbtest\airtypes.dbf
airtypes in use!
\vb\vxbtest\airtypes.dbf
\vb\vxbtest\airtypes.ntx
set meter bars back on for the rest
\vb\vxbtest\aircust.dbf
aircust in use!
\vb\vxbtest\aircust.dbf
\vb\vxbtest\aircust1.ntx
\vb\vxbtest\aircust2.ntx
\vb\vxbtest\aircust3.ntx
\vb\vxbtest\airbuyer.dbf
airbuyer in use!
\vb\vxbtest\airbuyer.dbf
\vb\vxbtest\airbuy1.ntx
\vb\vxbtest\airbuy2.ntx
\vb\vxbtest\aircraft.dbf
aircraft in use!
\vb\vxbtest\aircraft.dbf
\vb\vxbtest\aircraf1.ntx
\vb\vxbtest\aircraf2.ntx
PicMenu_Click
PrintItem_Click
RecStruc_Click
\vb\vxbtest\airtypes.dbf
Error Opening airtypes.dbf. Aborting.
\vb\vxbtest\airtypes.ntx
Error Opening airtypes.ntx. Aborting.
RelStart_Click
TestCopy_Click
disable items that would be affected by
closure of airtypes file
\vb\vxbtest\airtypes.dbf
\vb\vxbtest\airtypes.ntx
\vb\vxbtest\testcopy.dbf
Error in database copy struc
\vb\vxbtest\testcopy.dbf
index create opens and selects new index and-
returns the index select area. Zero (FALSE)
is returned if there was an error
\vb\vxbtest\testcopy.ntx
Error in index create
\vb\vxbtest\airtypes.dbf
Error in append from
New File
Zap successful
Zap Failed
\vb\vxbtest\testcopy.dbf
\vb\vxbtest\testcopy.ntx
TestCreate_Click
1234567890123456 (ruler to help alignment)
CATEGORY C 3 0
CATNAME C 15 0
our field length for the second field is shorter-
than the original file so when we appendfrom below
this field should be truncated and will show as
such in the browseb
\vb\vxbtest\typefile.dbf
Error in database creation
\vb\vxbtest\typefile.dbf
index create opens and selects new index and
returns the index select area. Zero (FALSE)
is returned if there was an error
\vb\vxbtest\typefile.ntx
category
Error in index create
\vb\vxbtest\airtypes.dbf
Error in append from
New File
\vb\vxbtest\typefile.dbf
\vb\vxbtest\typefile.ntx
TestDataCopy_Click
\vb\vxbtest\airtypes.dbf
\vb\vxbtest\airtypes.ntx
\vb\vxbtest\testdata.dbf
Error in database copy
\vb\vxbtest\testdata.dbf
Test delete range
Error in DeleteRange
index create opens and selects new index and
returns the index select area. Zero (FALSE)
is returned if there was an error
\vb\vxbtest\testdata.ntx
Error in index create
test ntx name function"
\vb\vxbtest\testdata.dbf
\vb\vxbtest\testdata.ntx
TextForm_Click
UMenu_Click
this proc shows how to set up user defined
menus on a browse window and also how toe
define the browse window initial position
Open aircraft types file-
\vb\vxbtest\airtypes.dbf
Error Opening airtypes.dbf. Aborting.
\vb\vxbtest\airtypes.ntx
Error Opening airtypes.ntx. Aborting.
Declare types table
category
Description
catname
Declare and build a user menu
19 items in the menu
the menu item params are:
(1) menu index number (from 1 to whatever was declared)
(2) attach this item to submenu number where 0 is the
top level browse menu and any other number must
refer to a menu index that was defined as VX_MENUHEAD
(3) the menu string. An ampersand in front of a character
will make that character the mnemonic. If a VX_SEPBAR
is being defined, pass a space " "n
(4) the menu item type as defined in the global module
where VX_MENUHEAD is a submenu header,h
VX_SEPBAR is a separator bar, and
VX_RETURN is a returnable itema
If any item is selected from the browse that is defined
as VX_RETURN, the RetVal parameter passed to vxBrowse
will contain the value of the menu index number plus 100
and negated (e.g., menu item 6 below will return -106).
The record pointer will be positioned at the record that
was highlighted when the return was made. If the user
presses the ENTER key in the browse, the RetVal willr
contain the record number that was highlighted when ENTER
was pressed.r
the first menu item will set up a submenu on theh
browse table top level menu (Attach to item 0)h
&File
the item above is attached to the submenu defined as item 1
&Open
&Save
the item above creates another submenu within the File menu
&New Name
the items above are under the sub menu defined as item 4)
&Print
E&xit
now we'll set up another menu on the top level browse menu
&Edit
and attach items to menu number 11 below it
&Copy
&Paste
Cl&ear
&Delete
The proc below will set up an initial position
for the browse window
the coordinates are in familiar character and linew
units. The first param is x (characters in from left),m
the second param is y (lines down from top), the thirdm
param is the width of the window in characters, and the
last param is the window height in linesa
if the user movers or sizes the window, and subsequente
vxBrowse calls are made with an intervening close of the
file, the window will retain its last position and size.
now we set up the browset
Aircraft Types
Note that the EDIT menu parameter should be FALSE if you
are defining your own menus.m
Value returned from browse was